//
//  main.swift
//  ProxyMode
//
//  Created by mac on 2017/10/31.
//  Copyright © 2017年 RRC. All rights reserved.
//

import Foundation

print("Hello, World!")

//定义玩家
var player:GamePlayer = try GamePlayer(name: "张三")
print("开始时间是：2009-8-25 10:45")
player.login(user: "zhangSan", password: "password")
player.killBoss()
player.upgrade()
print("结束时间是:2009-8-26 03:40")

print("**********************************")
let proxy:GamePlayerProxy = GamePlayerProxy(gamePlayer: player)
print("开始时间：2009-9-1 12:45")
proxy.login(user: "zhangSan", password: "password")
proxy.killBoss()
proxy.upgrade()
print("结束时间是：2009-9-1 21:00")

/*
 代理模式定义：为其他对象提供一种代理以控制对这个对象的访问，也叫做委托模式；
 */


let real = RealSubject()
let proxyStruts = ProxyStruts(objects: real)
proxyStruts.request()





